#ifndef __LM_NET_H__
#define __LM_NET_H__

using namespace std;

#include "lm_base.h"
#include "lm_net_base.h"


typedef struct
{
	uint iovLimit;
	uint size;
	char *start;
	char *p;
	char *end;
}fastStream_t;

class lmNet
{
	public:
		lmNet(char* ip, ushort p, char t);
		~lmNet();

	public:
		int  create_server();
		int  create_client();
		
		int nsend(string data);
		int nsend(char *data, int len);
		int nsendByIovec(struct iovec *iov, uint iovSize);

		uchar get_net_type();
		sock_t* get_sock();
		
	public:
		uint hasRecvSz;	
		uint fsHasRecvSz;
		fastStream_t *fs;

	private:
		ullong recvTime; 
		ullong sendTime;

		int    tClientFd;
		void   *stNSfd;
		void   *stNCfd;
		sock_t *sk;
};

#endif

